package com.yss.common.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 系统常量
 *
 * @author lsl
 */
@Getter
@AllArgsConstructor
public enum YssDataBaseEnum implements BaseEnum<String> {
    ORACLE("ORACLE", "Oracle数据库"),
    MYSQL("MYSQL", "MySql数据库"),
    DM("DM", "达梦数据库"),
    POSTGRESQL("POSTGRESQL", "Postgre数据库"),
    MARIADB("MARIADB", "MariaDB数据库"),
    DB2("DB2", "DB2数据库"),
    H2("H2", "H2数据库"),
    HSQL("HSQL", "HSQL数据库"),
    SQLITE("SQLITE", "SQLite数据库"),
    SQL_SERVER2005("SQLSERVER2005", "SQLServer2005数据库"),
    SQL_SERVER("SQLSERVER", "SQLServer数据库"),
    XU_GU("XUGU", "虚谷数据库"),
    KINGBASE_ES("KINGBASEES", "人大金仓数据库"),
    PHOENIX("PHOENIX", "Phoenix HBase数据库"),
    GAUSS("ZENITH", "Gauss 数据库"),
    CLICK_HOUSE("CLICKHOUSE", "clickhouse 数据库"),
    GBASE("GBASE", "南大通用(华库)数据库"),
    GBASEDBT("GBASEDBT", "南大通用数据库"),
    OSCAR("OSCAR", "神通数据库"),
    SYBASE("SYBASE", "Sybase ASE 数据库"),
    OCEAN_BASE("OCEANBASE", "OceanBase 数据库"),
    FIREBIRD("FIREBIRD", "Firebird 数据库"),
    HIGH_GO("HIGHGO", "瀚高数据库"),
    CUBRID("CUBRID", "CUBRID数据库"),
    GOLDILOCKS("GOLDILOCKS", "GOLDILOCKS数据库"),
    CSIIDB("CSIIDB", "CSIIDB数据库"),
    SAP_HANA("HANA", "SAP_HANA数据库"),
    IMPALA("IMPALA", "impala数据库"),
    OTHER("OTHER", "其他数据库");

    private final String code;
    private final String desc;

    public static YssDataBaseEnum getEnum(String code) {
        return Arrays.stream(values()).filter(b -> Objects.equals(b.code, code)).findFirst().orElse(null);
    }

    public static String getEnumDesc(String code) {
        YssDataBaseEnum e = getEnum(code);
        return e != null ? e.desc : null;
    }
}
